#ifndef __CONVERT_H__
#define __CONVERT_H__


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <getopt.h>           
#include <fcntl.h>            
#include <unistd.h>
#include <errno.h>
#include <malloc.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>

#include <asm/types.h>        
#include <linux/videodev2.h>

#define VIDEO_WIDTH 640
#define VIDEO_HEIGHT 480
#define VIDEO_FORMAT V4L2_PIX_FMT_YUYV
#define BUFFER_COUNT 4


typedef unsigned char  u8; 
typedef unsigned short u16;
typedef unsigned int   u32;

/*rgb24缓存 len: w*h*3 */
typedef struct __rgb24data
{
	int len;	/*rgb24缓存长度*/
	u8* buf;	/*rgb24缓存首地址*/
}RGB24;

typedef struct VideoBuffer {
    void   *start;
    size_t  length;

} VideoBuffer; 

void convert_yuv_to_rgb(void *yuv, void *rgb, unsigned int width, unsigned int height, unsigned int bps);
void convert_rgb_to_jpg_init(void);
int convert_rgb_to_jpg_work(void *rgb, FILE  *outfile, unsigned int width, unsigned int height, int quality);
void convert_rgb_to_jpg_exit(void);
int fenpei(struct v4l2_requestbuffers *reqbuf,int *cammerFd);
void initcamera(int *cammerFd);






 

#endif



